package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-09-26
 * Time: 19:23
 */
class Person {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void print() {
        System.out.println("姓名："+this.name+" , "+"年龄："+this.age);
    }
}

class Teacher extends Person{
    private String Id;

    public Teacher(String name, int age, String id) {
        super(name, age);
        Id = id;
    }

    public String getId() {
        return Id;
    }

    public void setId(String id) {
        Id = id;
    }

    public void print() {
        System.out.println("姓名："+getName()+" , "+"年龄："+getAge()+" , "+"工号："+this.Id);

    }
}
public class TeacherDemo {
    public static void main(String[] args) {

    }
    public static void main1(String[] args) {
        Person p = new Person("张三",18);
        Teacher t = new Teacher("李老师",40,"3456");
        p.print();
        t.print();
    }
}
